package com.lyl.xxx.modules.web.account.controller;

import com.github.pagehelper.PageInfo;
import com.lyl.xxx.modules.system.account.service.SysRoleService;
import com.lyl.xxx.modules.web.account.model.dto.RoleDTO;
import com.lyl.xxx.modules.web.account.model.vo.RoleVO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author Mr.Luo
 * @date 2022-09-22 17:49
 * @desc 角色管理
 */
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("/role")
public class RoleController {
    private final SysRoleService sysRoleService;

    @GetMapping("/list/{pageNo}/{pageSize}")
    public PageInfo<RoleVO> list(@PathVariable Integer pageNo, @PathVariable Integer pageSize, RoleDTO dto) {
        log.info("方法名: list,  请求参数: pageNo = [" + pageNo + "], pageSize = [" + pageSize + "], dto = [" + dto + "]");
        return sysRoleService.list(pageNo, pageSize, dto);
    }

    @DeleteMapping("/delBatch")
    public boolean delById(@RequestBody List<Long> ids) {
        return sysRoleService.removeByIds(ids);
    }

}
